package org.techism.server;

import java.util.List;
import java.util.SortedMap;
import java.util.logging.Logger;

import org.techism.client.bo.Event;
import org.techism.client.services.EventService;

import org.techism.server.dao.EventDao;
import org.techism.server.dao.impl.EventDaoImpl;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;

public class EventServiceImpl extends RemoteServiceServlet implements EventService {

    private static final Logger log = Logger.getLogger(EventServiceImpl.class.getName());

    private static final long serialVersionUID = -226024753378099074L;

    private static EventDao eventDao = new EventDaoImpl();

    @Override
    public Event getEventById(final String eventId) {
        return eventDao.loadByEventId(eventId);
    }

    @Override
    public SortedMap<String, List<Event>> getEventsByYear(final int year) {
        return eventDao.loadByYear(year);
    }

    @Override
    public SortedMap<String, Integer> getTags() {
        return eventDao.loadTagsForFutureEventsForCurrentYear();
    }

    @Override
    public SortedMap<String, List<Event>> getFutureEventsForThisYear(final String tag) {
        return eventDao.loadFutureEventsForCurrentYear(tag);
    }

    @Override
    public SortedMap<String, List<Event>> getFutureEventsForThisYear() {
        return eventDao.loadFutureEventsForCurrentYear();
    }
}